<template>
	<view style="background: #f5f5f5;min-height:100vh;">
		<view class="mine-head">
			<view class="user-head">
				<view class="left">
					<u-avatar class="avatar" :src="avatar"></u-avatar>
					<view class="name-text">欢迎您！{{userName}}</view>
				</view>
				<view class="right">
					<u-icon name="arrow-right" color="#ffffff" size="30"></u-icon>
				</view>
			</view>
		</view>
		<view class="mine-con">
			<view class="head-float">
				<u-grid :col="2">
					<u-grid-item @click="toReport">
						<image src="../../static/images/icon1.png" class="icon" />
						<view class="grid-text">我的报修</view>
					</u-grid-item>
					<u-grid-item @click="toRepair">
						<image src="../../static/images/icon2.png" class="icon" />
						<view class="grid-text">我的维护</view>
					</u-grid-item>
				</u-grid>
			</view>
			<view class="mine-content">
				<u-cell-group>
					<u-cell-item :icon="work" title="工单统计"></u-cell-item>
					<u-cell-item :icon="about" title="关于我们" @click="toAboutUs"></u-cell-item>
					<u-cell-item :icon="update" title="版本更新" value="新版本1.1.1"></u-cell-item>
				</u-cell-group>
			</view>
			<u-button type="primary" :custom-style="customStyle" hover-class="none">退出登录</u-button>

		</view>
		<u-tabbar :list="tabList" icon-size="52rpx" height="60px" :mid-button="true" @change="tabChange"
			active-color='#009dff'></u-tabbar>

	</view>
</template>
<script>
	export default {
		data() {
			return {
				tabList: [],
				avatorUrl: '',
				userName: '用户名称',
				isNew: '有新版本',
				work: '../../../static/images/work.png',
				about: '../../../static/images/about.png',
				update: '../../../static/images/update.png',
				customStyle: {
					marginTop: '40rpx',
					color: '#666',
					background: '#fff'
				}
			}

		},
		created() {
			this.tabList = this.$store.state.vuex_tabBar
		},
		computed: {
			avatar() {
				if (this.avatorUrl == '') {
					return '/static/images/user.png'
				} else {
					return this.avatorUrl
				}
			}
		},


		methods: {
			tabChange(index) {
				console.log('beforeSwitch index=====', index)
				if (index === 1) {
					this.$u.route('/pages/reportRepair/index');
				}
			},
			toReport() {
				this.$u.route('/pages/mine/mineReport/index')
			},
			toRepair() {
				this.$u.route('/pages/mine/mineRepair/index')
			},
			toAboutUs() {
				this.$u.route('/pages/mine/aboutUs/index')
			},
			toWorkSheet() {
				this.$u.route('/pages/mine/workSheet/index')
			},
			toUserList() {
				this.$u.route('/pages/mine/staffState/index')
			}
		}
	}
</script>

<style scoped lang="scss">
	.user-head {
		background: -moz-linear-gradient(left, #2496ff, #21acfe);
		background: -ms-linear-gradient(left, #2496ff, #21acfe);
		background: -o-linear-gradient(left, #2496ff, #21acfe);
		background: -webkit-linear-gradient(left, #2496ff, #21acfe);
		width: 100%;
		height: 460rpx;
		display: flex;
		align-items: center;
		justify-content: space-between;

		.left {
			display: flex;
			align-items: center;

			.avatar {
				margin-left: 40rpx;
				border: 10rpx solid #54b1fa;
				border-radius: 50%;
				width: 120rpx;
				height: 120rpx;
			}

			.name-text {
				margin-left: 30rpx;
				font-size: 32rpx;
				color: #FFFFFF;
			}
		}

		.right {
			display: flex;
			align-items: center;
			margin-right: 40rpx;
		}
	}

	.mine-con {
		padding: 30rpx;

		.head-float {
			margin-top: -130rpx;
			border-radius: 10rpx !important;
			background: #ffffff;
			border: 1rpx solid #ffffff;

			.icon {
				width: 80rpx;
				height: 80rpx;
				margin-bottom: 20rpx;
			}

			::v-deep .u-border-right:after {
				border-right-width: 0;
			}

			::v-deep .u-border-bottom:after {
				border-bottom-width: 0px;
			}
		}
	}

	.mine-content {
		margin-top: 40rpx;
		background: #FFFFFF;
		height: 100%;
		border-radius: 10rpx !important;

		// border: 1rpx solid #ffffff;
		// box-sizing: border-box;
		::v-deep .u-cell__left-icon-wrap {
			margin-right: 20rpx;
		}

	}

	::v-deep .u-grid-item {
		border-radius: 10rpx !important;
	}

	::v-deep .u-cell-item-box {
		border-radius: 10rpx !important;
	}

	::v-deep .u-tabbar__content__item__text {
		bottom: 6rpx !important;
		font-size: 24rpx !important;
	}
</style>
